import random
def creatList():                    #创建一个水王序列，随机生成0，1，
    waterList = []                  #生成0时，列表中添加0
    for i in range(1000):           #生成1时，列表中随机添加（1，1000）中的数值
        num = random.randint(0,1)   #序列长度为1000
        waterList.append(0) if num == 0 else waterList.append(random.randint(1,1000))
    return waterList
def solveWater(waterList):
    waterMap = {}
    for water in waterList:
        waterMap[water] = waterMap.get(water, 0) + 1#创建哈希表
    for i in range(len(waterMap.values())):#对哈希表中的数值进行遍历
        if list(waterMap.values())[i] > len(waterList) / 2:#当某个元素出现的次数超过序列长度的一般时输出该元素
            #print(list(waterMap.values())[i])
            return list(waterMap.keys())[i]
    #print(waterMap[0])
    return -1
if __name__ == '__main__':
    print(solveWater(creatList()))